package com.example.tenant.controller;

import com.example.tenant.entities.BotConfigDO;
import com.example.tenant.mapper.BotConfigMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
public class UserController {
    @Autowired
    private BotConfigMapper botConfigMapper;

    @GetMapping("/user/{id}")
    public BotConfigDO getUser(@PathVariable("id") Integer id) {
        BotConfigDO configDO = botConfigMapper.selectById(id);
        return configDO;
    }

    @PostMapping("/user")
    public int saveUser(@RequestBody BotConfigDO configDO) {
        int insert = botConfigMapper.insert(configDO);
        return insert;
    }

    @PostMapping("/updateUser")
    public Boolean updateUser(@RequestBody BotConfigDO configDO) {
        int i = botConfigMapper.updateById(configDO);
        return false;
    }
}
